package org.baojie.raft.delay;

import org.baojie.raft.message.RaftMsgSignal;

public interface Value {


    default Type type() {
        return Type.WaitVoteMsg;
    }

    enum Type {

        WaitVoteMsg(0, RaftMsgSignal.class);

        private final int num;
        private final Class<?> type;

        Type(int num, Class<?> type) {
            this.num = num;
            this.type = type;
        }

        public Class<?> type() {
            return type;
        }

        public int num() {
            return num;
        }

        public Class<?> convert(int num) {
            for (Type one : values()) {
                if (one.num() == num) {
                    return one.type();
                }
            }
            return Object.class;
        }

    }

}
